/**	
 * Title: CSE 5322 - Software Design Patterns
 * Description: 
 * Copyright: Copyright (c) UT Arlington, 2011
 * @author: Duy Nguyen(duyanh@uta.edu), Vivek Maheshwari(vivekm@uta.edu), Arjun Satish(arjun.satish@mavs.uta.edu), Lakshmana Srinivasa(lakshmana.srinivasa@mavs.uta.edu), Ismat Jahan(ismat.jahan@mavs.uta.edu)
 * @version 1.0
 */

package edu.uta.cse5322_2011_team3;

import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Document {
	protected String content;

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Document(String content) {
		this.content = content;
	}

	public Document(Document document) {
		this.content = document.getContent();
	}

	public ArrayList<String> toSentences() {

		Pattern splittingPattern = Pattern.compile("[\\r\\n]+");
		// Split input with the pattern
		String[] lines = splittingPattern.split(content);

		ArrayList<String> buffer = null;
		// The pattern matches control characters
		Pattern p = Pattern.compile("\\p{Cntrl}");
		Matcher m = p.matcher("");

		buffer = new ArrayList<String>();
		for (String line : lines) {

			m.reset(line);
			String cleanLine = m.replaceAll("").trim();
			if (cleanLine.length() > 0) {
				buffer.add(cleanLine);
			}

		}

		return buffer;

	}

}
